package keyboard;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import screen.*;
import bootloader.*;

public class APDKeyListener extends KeyAdapter {
    private KeyRecorder recorder;
    public APDKeyListener(Main f) {
        recorder = new KeyRecorder(f.getScreen());
    }
    @Override
    public void keyPressed(KeyEvent e) {
        int code = e.getKeyCode();
        char c = e.getKeyChar();
        if (c >= 32 && c <= 127) {
            recorder.add(c);
        }
        if (code == KeyEvent.VK_ENTER) {
            recorder.execute();
        }
        if (code == KeyEvent.VK_BACK_SPACE) {
            recorder.add('\b');
        }
    }
}